home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / EXT / P-T / PowerLock II.cpt / PowerLock ƒ / AddOnsƒ / AddOnIntf.p < prev    next >
Text File  |  1991-12-12  |  6KB  |  128 lines

  1. {AddOnIntf, © Rohan Cook, November 1991}
  2. {Part of the PowerLock Security Package}
  3. {This source code can be used in any fashion by all PowerLock users}
  4.  
  5. {Provides an interface between PowerLock and code resources of type 'adOn'}
  6. {For information about this source, see the PowerLock package or write to:}
  7. {    Rohan Cook                }
  8. {    PO Box 317                }
  9. {    Mornington Vic 3931        }
  10. {    Australia                    }
  11.  
  12. {0.1    1/10/91        .    commenced writing interface}
  13. {0.2    27/10/91    .    implemented cbReqUsedToday}
  14. {0.3    7/11/91        .    implemented aReqPWOK message}
  15. {0.4    8/11            .    cbReqLogRaw written}
  16. {0.5    18/11            .    support for aReqDlgItem introduced}
  17. {                        .    addOn data format changed to include 'dlg' & 'item'}
  18. {                        .    interface file includes constants for each of PowerLock's dialogs}
  19. {0.6    23/11            .    added cbReqUserID}
  20. {                        .    modified adOnRec to incl both PLs AOintf version and the actual add-ons AOintf version}
  21. {                        .    aReqStartUp sets aoAOIFVers}
  22. {                        .    put intf versions at start of record}
  23. {                        .    PL modified to check versions}
  24. {0.7    12/12            .    wrote cbReqIsLicenced}
  25. {1.00    12/12        .    release version of addOn interface}
  26.  
  27. unit adOnIntf;
  28. interface
  29.  
  30.     type
  31.  
  32. {adOn Data Type    -    passed between adOn and PowerLock}
  33. {->        = data that is sent from PowerLock}
  34. {<-        = result that your adOn resource can return}
  35. {<->    = two way data}
  36.  
  37.         adOnPtr = ^adOnRec;
  38.         adOnRec = record
  39.                 plAOIFVers: integer;        { ->    PowerLocks AddOn Interface Version - format as per PowerLock Version}
  40.                 aoAOIFVers: integer;        {<-        The AddOns AddOn Interface Version - returned in aReqStartUp}
  41.                 plVersion: integer;        { ->    PowerLock Version:  200 = 2.0.0, 204=2.0.4 etc}
  42.                 username: str255;        {<->    username, if used and entered, NUL if not}
  43.                 attempts: integer;        { ->    number of password attempts so far}
  44.                 userData: handle;            {<->    unused data handle - user data can be stored here}
  45.                 bool: boolean;                { ->    miscellaneous boolean result}
  46.                 continue: boolean;        {<-        normally true - return false to abandon current operation}
  47.                 misc: handle;                { ->    handle to miscellaneous data}
  48.                 dlg: integer;                { ->    Resource ID of current dialog}
  49.                 item: integer;                { ->    item # of dialog item in question}
  50.                 err: OSErr;                {<-        last error code}
  51.                 request: str255;            {<-        data to pass thru to call back routine}
  52.                 result: str255;            { ->    result returned after callbacks}
  53.                 fileRef: integer;            { ->    ref # of resource file containing addon}
  54.                 callBackProc: procPtr;    { ->    pointer to callback handling procedure}
  55.                 reserved1: longint;        {        do NOT use any reserved fields}
  56.                 reserved2: longint;
  57.                 reserved3: longint;
  58.                 reserved4: str255;
  59.             end;
  60.  
  61.     const
  62.  
  63. {AddOn Requestors}
  64. {NOTE:        requestors marked • will allow cancellation of the operation by returning 'continue:=false'}
  65.         aReqStartUp = 1;                {sent as soon as PowerLock is initialised}
  66.         aReqTimeOut = 2;            {•    just before PL times out}
  67.         aReqChangeBtn = 3;            {•    when Change button is pressed}
  68.         aReqShutDownBtn = 4;        {•    when ShutDown button is pressed}
  69.         aReqPrefsBtn = 5;            {•    when Prefs button is pressed}
  70.         aReqOKBtn = 6;                {•    when OK on main dialog is pressed}
  71.         aReqUserListBtn = 7;        {•    when Userlist button on Prefs dialog is pressed}
  72.         aReqSaveUserList = 8;        {•    sent when userlist is about to be saved            username = SuperUser name}
  73.         aReqShutDown = 9;            {•    sent whenever PowerLock is about to be shutdown}
  74.         aReqQuit = 10;                {sent immediately before PowerLock quits}
  75.         aReqPWIncorrect = 11;        {sent whenever illegal password entered            attempts=total # bad attempts at pw, username=username entered}
  76.         aReqPWOK = 12;                {• sent once password has been validated}
  77.         aReqDlgItem = 13;            {• sent whenever a dialog item has an event}
  78.         aReqBootBlocks = 20;        {• sent on Boot Blocks button in Prefs                bool=current state (before click) of button}
  79.         aReqVersion = 99;            {sent when PowerLock 2nd About Box requested}
  80.  
  81. {CallBack Requests}
  82.         cbReqLog = 1;                    {log username & 'request' & time & date to the log file if log file enabled}
  83.         cbReqLogRaw = 2;            {log 'request' to log file 'as is' regardless if log file enabled - adds a return to the end of 'request'}
  84.         cbReqMsg = 3;                {display 'request' in PL message box}
  85.         cbReqAlert = 4;                {display 'request' as a PL Stop Alert Box}
  86.         cbReqShutDown = 5;            {shut down PowerLock}
  87.         cbReqDraw = 6;                {create new window, draw file 'request', wait for an event, close window}
  88.         cbReqYesNo = 7;                {prompt with 'request', return in result 'Y' or 'N'}
  89.         cbReqUpdate = 8;                {update the desktop}
  90.         cbReqUsers = 9;                {returns in 'result' the total number of user names set up}
  91.         cbReqUser = 10;                {given user ID in 'request', returns the decrypted user name in 'result' & current username in 'username'}
  92.         cbReqUserID = 11;            {given a username in 'username', return UserID in 'result'}
  93.         cbReqUsedToday = 12;        {returns true in bool if PowerLock has been used today}
  94.         cbReqAppResFile = 13;        {returns in fileRef a ref to PowerLock application}
  95.         cbReqPrefsResFile = 14;        {returns in fileRef a ref to the Prefs file}
  96.         cbReqAddOnResFile = 15;    {restores fileRef to point to the Add-On file}
  97.         cbReqIsLicenced = 16;        {returns true in bool if PowerLock is a licenced copy or false if it is unlicenced}
  98.  
  99. {PowerLock Dialog IDs}
  100. {NOTE:        the Change Password Dialog does not support the aReqDlgItem message & therefore is not listed}
  101. {            Refer to a DeRez list or ResEdit for item numbers of each button & field                            }
  102.         DLOGmain = 128;                {main PowerLock dialog - single user (prompts for password only)}
  103.         DLOGmainWithUsers = 132;    {main PowerLock dialog - multiuser (prompts for username & password)}
  104.         DLOGuserlist = 131;            {editing PowerLock usernames}
  105.         DLOGprefs = 133;            {Preferences dialog}
  106.         DLOGsuperPrefs = 134;        {SuperSecurity Preferences dialog}
  107.  
  108.     procedure DoCBReq (req: integer; adOn: adOnPtr);
  109.     function AOIntfVersion: integer;    {return version number of AddOn Interface}
  110.  
  111. implementation
  112.  
  113.     procedure CallBack (req: integer; adOn: adOnPtr; addr: procPtr);
  114.     inline
  115.         $205F,  { MOVE.L (SP)+,A0 }
  116.         $4E90;  { JSR    (A0)     }
  117.  
  118.     procedure DoCBReq (req: integer; adOn: adOnPtr);
  119.     begin
  120.         CallBack(req, adOn, adOn^.CallBackProc);
  121.     end;
  122.  
  123.     function AOIntfVersion: integer;
  124.     begin
  125.         AOIntfVersion := 100;
  126.     end;
  127.  
  128. end.